package com.zhongfl.crm.enums.boss;

import com.zhongfl.crm.exception.EnumParseException;
import lombok.Getter;

import java.util.Objects;

/**
 * OrderMemorandumStageEnum 备忘录跟进阶段或方式枚举
 *
 * @author tiantian
 * @date 2018/6/27 22:18
 */
@Getter
public enum OrderMemorandumStageEnum {
    PHONE("2450799", "电话"),

    WECHAT("2450801", "微信"),

    INTERVIEW("2450802", "当面拜访"),

    STAGE_INTERVIEW("2450804", "1-面谈"),

    STAGE_PINGGU("2671253", "2-评估"),

    STAGE_QIANYUE("2671254", "3-签约"),

    STAGE_XIAHU("2671255", "4-下户"),

    STAGE_CAIJI("2671256", "5-采集"),

    STAGE_BAOJUAN("2671257", "6-报卷"),

    STAGE_SHENPI("2671258", "7-审批"),

    STAGE_PIDAI("3761229", "8-批贷"),

    STAGE_JINDI("2671259", "9-进抵"),

    STAGE_FANGKUAN("2671260", "10-放款"),

    STAGE_JIESUAN("2671261", "11-结算");

    private String lxCategoryId;
    private String desc;

    OrderMemorandumStageEnum(String lxCategoryId, String desc) {
        this.lxCategoryId = lxCategoryId;
        this.desc = desc;
    }

    public static OrderMemorandumStageEnum getEnum(String lxCategoryId) {
        for (OrderMemorandumStageEnum statusEnum : OrderMemorandumStageEnum.values()) {
            if (statusEnum.getLxCategoryId().equals(lxCategoryId)) {
                return statusEnum;
            }
        }
        throw new EnumParseException(OrderMemorandumStageEnum.class, String.valueOf(lxCategoryId));
    }

    public static OrderMemorandumStageEnum valueOf(WorkOrderTypeCode workOrderTypeCode) {
        if (Objects.isNull(workOrderTypeCode)) {
            return null;
        }
        switch (workOrderTypeCode) {

            case VALUATION:
                return STAGE_PINGGU;
            case COMPANY_WRAP:
                return STAGE_CAIJI;
            case INTERVIEW:
                return STAGE_QIANYUE;
            case INFORMATION:
                return STAGE_CAIJI;
            case ROLLS:
                return STAGE_BAOJUAN;
            case LOAN_APPROVE:
                return STAGE_SHENPI;
            case WARRANT:
                return STAGE_JINDI;
            case LOANED:
                return STAGE_FANGKUAN;
            case LOAN_FEE:
                return STAGE_JIESUAN;
            case LIQUIDATION:
                return STAGE_JIESUAN;
            case OTHER:
            default:
                return null;
        }
    }
}
